<?php
$plugin->load_plugin_lang();

$activity_id = $module->get_module_id_created_module();
$nb_categories = $Sql->Query("SELECT nb_categories FROM ".PREFIX."plugin_dragdrop_features WHERE id=".$module->get_module_id_created_module(),__LINE__,__FILE__);
$nb_entities = $Sql->Query("SELECT nb_entities FROM ".PREFIX."plugin_dragdrop_features WHERE id=".$module->get_module_id_created_module(),__LINE__,__FILE__);

$tpl = new Template_plugin('course/plugin/drag_and_drop/templates/admin/edit/dragdrop_fillin.tpl');

$tpl->Set_filenames(array(
	'modif' => '/course/plugin/drag_and_drop/templates/admin/edit/dragdrop_fillin.tpl'
));

for($i=0; $i<$nb_categories; $i++)
{
	$tpl->Assign_block_vars('loopCateg', array(
		'ID_CATEGORY' => $i+1,
		'CATEGORY_NAME' => $Sql->Query("SELECT category_name FROM ".PREFIX."plugin_dragdrop WHERE category_id=".($i+1)." AND id=".$module->get_module_id_created_module(),__LINE__,__FILE__)
	));
	
	for($j=0; $j<$nb_entities; $j++)
	{
		$tpl->Assign_block_vars('loopCateg.loopEntities', array(
			'ID_ENTITY' => $j+1,
			'ENTITY' => $Sql->Query("SELECT entity_".($j+1)." FROM ".PREFIX."plugin_dragdrop WHERE category_id=".($i+1)." AND id=".$module->get_module_id_created_module(),__LINE__,__FILE__)
		));
	}
}

$tpl->assign_vars(array(
	'TEST_VAR_LANG'=>$LANG['test'],
	'ACTION_FORM'=>$currentLink."update&activity_id=".$activity_id,
	'NB_CATEGORIES'=>$nb_categories,
	'NB_ENTITIES'=>$nb_entities,
	'CONFIRM'=>$LANG['confirm_message'],
));

$tpl->Pparse('modif');
?>